-- ----------------------------------------------------------
--
-- Author: czf
-- date: 2018-12-14
-- description: 享元模式-工厂(对象池)
--
-- ----------------------------------------------------------

ShapeFactory = ShapeFactory or BaseClass()

function ShapeFactory:__init()
	if ShapeFactory.Instance then
		print("不可以对单例对象重复实例化")
	end
	ShapeFactory.Instance = self

	self.circleMap = {}
end

function ShapeFactory:GetCircle(color)
	local circle = self.circleMap[color]

	if not circle then
		circle = Circle.New(color)
		self.circleMap[color] = circle
		print("Creating circle of color : " .. color)
	end

	return circle
end